﻿using System;
public class AlarmClock
{
    public event EventHandler Tick;
    public event EventHandler Alarm;
    public TimeSpan AlarmTime { get; set; }
    public void Start()
    {
        Timer timer = new Timer(TimerCallback, null, TimeSpan.Zero, TimeSpan.FromSeconds(1));
    }
    private void TimerCallback(object state)
    {
        OnTick(EventArgs.Empty);
        if (DateTime.Now.TimeOfDay >= AlarmTime)
        {
            OnAlarm(EventArgs.Empty);
        }
    }
    protected virtual void OnTick(EventArgs e)
    {
        Tick?.Invoke(this, e);
    }
    protected virtual void OnAlarm(EventArgs e)
    {
        Alarm?.Invoke(this, e);
    }
}

class Program
{
    static void Main(string[] args)
    {
        AlarmClock alarmClock = new AlarmClock();
        alarmClock.AlarmTime = DateTime.Now.TimeOfDay.Add(TimeSpan.FromSeconds(10));
        alarmClock.Tick += (sender, e) => Console.WriteLine("Tick");
        alarmClock.Alarm += (sender, e) => Console.WriteLine("Alarm");
        alarmClock.Start();
        Console.ReadLine();
    }
}
